import {ApiProperty} from "@nestjs/swagger";
import {IsArray, IsBoolean, IsNotEmpty, IsOptional} from "class-validator";
import {Column} from "typeorm";

export enum BlogType {
	MarkDownFile=1,
	richText=2
}
export class SaveBlogDto {
	@ApiProperty({ description: 'id',type: Number,required:false })
	@IsOptional()
	id?: number

	@ApiProperty({ description: '博客内容（markdown、富文本文本）' })
	// @IsNotEmpty({message:'博客内容不能为空'})
	@IsOptional()
	blogContent?: string

	@ApiProperty({ description: '博客内容描述',required:false })
	@IsNotEmpty({message:'描述信息'})
	blogDesc?: string

	@ApiProperty({ description: '编辑器类型）' })
	@IsNotEmpty({message:'编辑器类型不能为空'})
	editorType: 1 | 2

	@ApiProperty({ description: '文章标题' })
	@IsNotEmpty({message:'文章标题不能为空'})
	blogTitle: string

	@ApiProperty({ description: '文章类型',type: Number,required: true })
	@IsNotEmpty({message:'文章类型不能为空'})
	blogType: number

	@ApiProperty({ description: '封面图' })
	coverUrl: string

	@ApiProperty({ description: '标签列表，tag id数组',type: [Number,String],required:false })
	@IsArray({message:'标签列表，tag id数组' })
	@IsOptional()
	tagList?: number[]

	@ApiProperty({ description: '是否可用',type: Boolean,default:true,required:false })
	@IsOptional()
	@IsBoolean({message:'是否可用应该为boolean类型'})
	enable?: boolean
}
